@*
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*@
@import scalaz.{\/}
@(theMenu: Html,
  crumbs: IndexedSeq[models.navigation.BreadCrumbs.BreadCrumbRendered],
  errorOrSuccess: IndexedSeq[kafka.manager.ApiError] \/ Unit,
  actionTitle: String,
  successLink: models.FollowLink,
  errorLink: models.FollowLink)(implicit messages: play.api.i18n.Messages)

@link(followLink: FollowLink) = {
    <div class="alert alert-success" role="alert">Done!</div>
    <div class="alert alert-info" role="alert">
        <a href="@followLink.url">@followLink.title</a>
    </div>
}

@main(actionTitle, menu = theMenu, breadcrumbs = views.html.navigation.breadCrumbs(crumbs)) {

    <div class="col-md-6 un-pad-me">
        <div class="panel panel-default">
            <div class="panel-heading"><h3>@actionTitle</h3></div>
            @errorOrSuccess.fold( errs => errs.map(views.html.errors.onApiError(_, Some(errorLink))) , b => link(successLink))
        </div>
    </div>
}
